﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<div class="modal-dialog x-modal-dialog" style="width: 600px; margin-top: 100px;">

  <div class="modal-content">

    <div class="modal-header x-breadcrumb no-bottom-border clearfix">

      <h2><i class="glyphicon glyphicon-search" title="过滤查询"></i>&nbsp;&nbsp;<span>动作库&nbsp;-&nbsp;过滤查询</span></h2>

      <button type="button" class="close" data-dismiss="modal">&times;</button>

    </div>

    <form class="form-horizontal" method="GET" action="${ctx.host}/movements" data-validate="true">

      <input type="hidden" name="filter" value="true" >
      
      <div class="modal-body">
      
        <div class="form-group x-form-group">
          <label class="col-xs-3 control-label">名称</label>
          <div class="pull-left col-xs-8">
            <input type="text" class="form-control" name="name" value="${param.name}" placeholder="支持模糊查询"/>
          </div>
        </div>

        <div class="form-group x-form-group">
          <label class="col-xs-3 control-label">类别</label>
          <div class="pull-left col-xs-8">
            <select name="categoryId" class="select2 form-control">
              <option></option>
              <c:forEach var="category" items="${persist.categories}">
                <c:if test="${not category.disabled}">
                  <option value="${category.id}" ${category.id == param.categoryId ? 'selected' : ''}>${category.name}</option>
                </c:if>
              </c:forEach>
            </select>
            </div>
          </div>
          
          <div class="form-group x-form-group">
            <label class="col-xs-3 control-label">器材</label>
	        <div class="pull-left col-xs-8">
	          <select name="equipmentId" class="select2 form-control">
                <option></option>
                <c:forEach var="equipment" items="${persist.equipments}">
                  <c:if test="${not equipment.disabled}">
                    <option value="${equipment.id}" ${equipment.id == param.equipmentId ? 'selected' : ''}>${equipment.name}</option>
                  </c:if>
                </c:forEach>
	          </select>
	        </div>
          </div>
        
      </div>

      <div class="modal-footer">
        <button type="submit" class="btn btn-success btn-shadow btn-shadow-success x-btn">查询</button>&nbsp;&nbsp;&nbsp;&nbsp;
        <button type="button" class="btn btn-default btn-shadow btn-shadow-default x-btn" data-dismiss="modal">取消</button>
      </div>

    </form>

  </div>
  
  <script type="text/javascript">

    $(document).ready(function(){

        $('select[name="categoryId"]').select2({
            placeholder : '请选择类型',
            minimumResultsForSearch : -1,
            allowClear : true
        });

     $('select[name="equipmentId"]').select2({
        placeholder : '请选择器材',
        minimumResultsForSearch : -1,
        allowClear : true
    });
    })

  </script>
  
</div>